Program storage requirements can be divided into at least two categories: a data section and a code section. At least some portion of the data section is typically allocated to a modifiable memory such as volatile random access memory (RAM) to permit manipulation and modification of data during program execution.
In order to execute a program, the program is typically retrieved from a nonvolatile mass storage device such as an electromechanical disk drive or a compact disk (CD) drive and assembled into an executable image in the volatile memory. Thus the code section may also reside within the volatile memory.
One disadvantage of this technique of program storage is the time consumed when loading the program from the nonvolatile memory and constructing the executable image in the volatile memory. Another disadvantage is that this loading process must be performed each time power is re-applied to the computer system given that the volatile memory retains its contents only while power is applied.
In order to avoid some of the disadvantages, a program can be placed into a nonvolatile memory as an executable image and executed directly from a nonvolatile memory. Nonvolatile memory offers the ability to preserve the contents of the memory after power is removed. Unfortunately, many nonvolatile memories are not as readily modifiable as their volatile counterparts. For example, a nonvolatile memory may not be modifiable at all (i.e., read only memory, ROM). Alternatively, the nonvolatile memory may have certain characteristics (e.g., erasable only in blocks) that require substantially more overhead to manage modification than that required by modifiable volatile memories.
Although the program typically informs the operating system of its modifiable memory requirements for data storage, the program may unexpectedly attempt to modify areas, such as code storage areas, that are otherwise presumed by the operating system to not be modified by the executing program. As long as the data and code are stored in modifiable volatile memory, such unexpected modifications do not typically prevent the program from successfully executing. The program may not successfully execute, however, if modification of information stored in nonvolatile memory is required due to the limitations of the nonvolatile memory. Thus a program designed to execute in a modifiable memory may have to be rewritten to permit execution in a nonvolatile memory.